home *** CD-ROM | disk | FTP | other *** search
- Path: ep.com!olpe
- From: Pete Olpe <olpe@ep.com>
- Newsgroups: comp.lang.c++
- Subject: MFC 4.0 OnDraw and DC question
- Date: Mon, 22 Jan 1996 11:50:29 -0800
- Organization: NETCOM Network Operations
- Message-ID: <Pine.AUX.3.91.960122113748.8497A-100000@ep.com>
- NNTP-Posting-Host: ep.com
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
-
- In my "OnDraw(CDC* pDC)" routine I call another member function that
- performs the actual work of drawing. I pass it the pointer to the DC that
- was passed to the OnDraw() routine. It is slow, and eventually bombs by
- failing to create a font, or brush, or whatever. A very simplified
- version of the code follows:
-
- myClass::OnDraw(CDC* pDC)
- {
- myDrawRoutine(pDC);
- }
-
- myClass::myDrawRoutine(CDC* pDC)
- {
- create fonts, brushes, pens;
- pDC->SelectObject(fonts, brushes, pens, etc);
- pDC->DrawText(...);
- }
-
-
- When I substitute the code for "myDrawRoutine" back inline in the
- "OnDraw" routine, the drawing speeds up and never seems to bomb by
- failing to create an object or select an object into the DC.
-
- Does anyone have any ideas why splitting out the code from an "OnDraw"
- routine would not work?
-
- -Pete-
-